﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AMDev.BNET.ClientAPI
{
    public class BNETResponse
    {
        #region Fields

        private bool hasError;
        private Object responseData;
        private BNETErrorValues errorValue;
        private String errorMessage;
        private DateTime time;

        #endregion

        #region Properties

        public Object ResponseData
        {
            get
            {
                return this.responseData;
            }
            protected set
            {
                this.responseData = value;
            }
        }

        public bool HasError
        {
            get
            {
                return this.hasError;
            }
            protected set
            {
                this.hasError = value;
            }
        }

        public BNETErrorValues ErrorValue
        {
            get
            {
                return this.errorValue;
            }
            protected set
            {
                this.errorValue = value;
            }
        }

        public String ErrorMessage
        {
            get
            {
                return this.errorMessage;
            }
            protected set
            {
                this.errorMessage = value;
            }
        }

        public DateTime Time
        {
            get
            {
                return this.time;
            }
        }

        #endregion

        #region .ctor

        internal BNETResponse(Object responseData)
            : this(responseData, false, BNETErrorValues.None, null)
        {
        }

        internal BNETResponse(Object responseData, BNETErrorValues errorValue, String errorMessage)
            : this(responseData, true, errorValue, errorMessage)
        {
        }

        internal BNETResponse(Object responseData, bool hasError, BNETErrorValues errorValue, String errorMessage)
        {
            this.ResponseData = responseData;
            this.HasError = hasError;
            this.ErrorValue = errorValue;
            this.ErrorMessage = errorMessage;
            this.time = DateTime.Now;
        }

        #endregion
    }
}

